#include "StdAfx.h"
#include "MyPayload.h"
#include "TypeIds.h"

namespace CO { namespace MyGroupNamespace { namespace MyPackageNamespace {

MyPayload::MyPayload(double value) :
	//
	// TODO:  Initialize attributes.
	//
	value_(value)
{
}

MyPayload::~MyPayload(void)
{
}

double MyPayload::value(void)
{
	return value_;
}

bool MyPayload::isSafe(void) const
{
	//
	// TODO:  If you have any IPayload derived attributes, 
	//		return (myAttribute1.isSafe() && myAttribute2.isSafe());
	//
	return true;	// No pointer attributes.
}

SpiFoundation::RoomFW::PayloadTypeId MyPayload::getTypeID() const
{
	//
	// TODO:  Return a unique id for your payload.
	//
	return PTID_MY_PAYLOAD_ID;
}

std::string MyPayload::toString(void) const
{
	//
	// TODO:  Format your attributes in an easy to read format for debugging.
	//
	std::stringstream ostr;
	ostr << "MyPayload: value=" << value_;
	return ostr.str();
}

void MyPayload::serialize(SpiFoundation::RoomFW::oarchive& ar, const unsigned int /*version*/) const
{
	//
	// TODO:  Serialize your attributes.
	//
	//
	// Note:  This is only used for binding over TCP/IP.
	//
	ar << value_;
}

void MyPayload::serialize(SpiFoundation::RoomFW::iarchive& ar, const unsigned int /*version*/)
{
	//
	// TODO:  Serialize your attributes.
	//
	//
	// Note:  This is only used for binding over TCP/IP.
	//
	ar >> value_;
}

SpiFoundation::RoomFW::IPayloadSP MyPayload::clone()
{
	return SpiFoundation::RoomFW::IPayloadSP(new MyPayload(*this));
}

}}} // End namespace
